package UI;

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;

import rmi.RMI;

public class ServerFrame extends JFrame {

	private JPanel contentPane;
	private RMI rmi;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		

		UIManager.put("RootPane.setupButtonVisible", false);
		BeautyEyeLNFHelper.translucencyAtFrameInactive = false;
		try {

			org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ServerFrame frame = new ServerFrame();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ServerFrame() {
		rmi=new RMI();
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton button = new JButton("开启服务器");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				rmi.startRMI();
			}
		});
		button.setBounds(82, 57, 93, 23);
		contentPane.add(button);
		
		JButton button_1 = new JButton("关闭服务器");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				rmi.closeRMI();
			}
		});
		button_1.setBounds(230, 57, 93, 23);
		contentPane.add(button_1);
	}
}
